#pragma once
#include "dll_setup.h"

#include <string>
#include <map>
#include <vector>

using std::multimap;
using std::vector;
using std::string;
using std::pair;

class SAPPHIRE_ENGINE IniParser
{
public:
	void clear();
	void load(const string &path);
	void save(const string &path);

	int getPropertyCount()	{return _vector.size();}
	string getKey(int i)	{return _vector[i].first;}
	string getString(int i)	{return _vector[i].second;}

	bool getBool(const string &key) const;
	int getInt(const string &key) const;
	float getFloat(const string &key) const;
	string getString(const string &key) const;
	void getString(vector<string> &vstr, const string &key);
	void setInt(const string &key, int value);
	void setBool(const string &key, bool value);
	void setFloat(const string &key, float value);
	void setString(const string &key, const string &value);

	string toString();

private:
	static const int maxLine= 1024;

public:	
	typedef pair<string, string> Pair;
	typedef multimap<string, string> Map;
	typedef vector<Pair> Vector;
	
private:
	Vector _vector;
	Map _map;
	string _path;
};